<?php

class Admin_sampleController extends ApiController {
	const Sampledata =[[
		'userId' => '1',
		'username' => 'admin',
		'password' => '$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG',
		'salt' => 'null',
		'status' => 'null',
		'realName' => '超级管理员',
		'email' => '8540854@qq.com',
		'avatar' => 'null',
		'sex' => '1',
		'phone' => '15543526531',
		'enable' => '1',
		'login' => '1',
		'roleIds' => 'null'
	], [
		'userId' => '442488661347536896',
		'username' => '854085467',
		'password' => 'null',
		'salt' => 'null',
		'status' => 'null',
		'realName' => '就眠仪式',
		'email' => 'null',
		'avatar' => 'null',
		'sex' => '1',
		'phone' => '1555324324234',
		'enable' => '0',
		'login' => '1',
		'roleIds' => 'null'
	], [
		'userId' => '442492965651353600',
		'username' => '970796069',
		'password' => 'null',
		'salt' => 'null',
		'status' => 'null',
		'realName' => '王二麻子',
		'email' => 'null',
		'avatar' => 'null',
		'sex' => '1',
		'phone' => '1555324324234',
		'enable' => '1',
		'login' => '1',
		'roleIds' => 'null'
	], [
		'userId' => '1',
		'username' => 'admin',
		'password' => '$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG',
		'salt' => 'null',
		'status' => 'null',
		'realName' => '超级管理员',
		'email' => '8540854@qq.com',
		'avatar' => 'null',
		'sex' => '1',
		'phone' => '15543526531',
		'enable' => '1',
		'login' => '1',
		'roleIds' => 'null'
	], [
		'userId' => '442488661347536896',
		'username' => '854085467',
		'password' => 'null',
		'salt' => 'null',
		'status' => 'null',
		'realName' => '就眠仪式',
		'email' => 'null',
		'avatar' => 'null',
		'sex' => '1',
		'phone' => '1555324324234',
		'enable' => '1',
		'login' => '1',
		'roleIds' => 'null'
	], [
		'userId' => '442492965651353600',
		'username' => '970796069',
		'password' => 'null',
		'salt' => 'null',
		'status' => 'null',
		'realName' => '王二麻子',
		'email' => 'null',
		'avatar' => 'null',
		'sex' => '1',
		'phone' => '1555324324234',
		'enable' => '1',
		'login' => '1',
		'roleIds' => 'null'
	], [
		'userId' => '1',
		'username' => 'admin',
		'password' => '$2a$10$1K7E1.IYCrsoZVCb6utOo.5jENtfOzhdKWhc49t2lk.UQd7Oam4FG',
		'salt' => 'null',
		'status' => 'null',
		'realName' => '超级管理员',
		'email' => '8540854@qq.com',
		'avatar' => 'null',
		'sex' => '1',
		'phone' => '15543526531',
		'enable' => '1',
		'login' => '1',
		'roleIds' => 'null'
	], [
		'userId' => '442488661347536896',
		'username' => '854085467',
		'password' => 'null',
		'salt' => 'null',
		'status' => 'null',
		'realName' => '就眠仪式',
		'email' => 'null',
		'avatar' => 'null',
		'sex' => '1',
		'phone' => '1555324324234',
		'enable' => '1',
		'login' => '1',
		'roleIds' => 'null'
	]];
	public function init() {
		parent::init();
		$this->G['admin'] = Lib\Site::AdminSignCheck();
		if (!$this->G['admin']) {
			$this->errorMessage('无权登录或者登录态已过期，请重新从 WitFrame 应用设置进入');
		}
	}
	// 范例模块模拟数据
	public function indexAction() {
		$sampledata = self::Sampledata;
		echo  json_encode(['code'=>0,'msg'=>'','count'=>'20','data'=>$sampledata]);
	}
	// Smple模块新增页面
	public function addAction() {
		$this->template('admin/sample/add');
	}

	// Smple模块编辑页面
	public function editAction() {
		$this->template('admin/sample/edit');
	}
	public function saveAction() {

		// 业务逻辑处理

		$this->successMessage('操作成功','');
	}
	public function removeAction() {
		// 业务逻辑处理

		$this->successMessage('删除成功','');
	}


}